/// Antd组件
import {
  Icon,
  Button,
  Tree,
  Dropdown,
  Card,
  Tag,
  Form,
  Input,
  Checkbox,
  Select,
  Spin,
  Space,
  Tooltip,
  message,
  Breadcrumb,
  Layout,
  DatePicker,
  ConfigProvider,
  Upload,
  Popconfirm,
  Divider,
  Empty,
  Table,
  FormModel,
  Pagination,
  InputNumber,
  Modal,
  Switch,
  Cascader,
  Radio
} from 'ant-design-vue'
// 自定义||二次封装组件
import {
  ActionButtons,
  DictSelect,
  StandardDialog,
  StandardTable,
  StandardDrawer
} from '@/common/components'
const Antd = {
  Icon,
  Button,
  Card,
  Tag,
  Dropdown,
  Tree,
  Form,
  Spin,
  Space,
  Tooltip,
  Breadcrumb,
  Layout,
  Input,
  Checkbox,
  Select,
  DatePicker,
  ConfigProvider,
  Upload,
  Popconfirm,
  Divider,
  Empty,
  Table,
  FormModel,
  Pagination,
  InputNumber,
  Modal,
  Switch,
  Cascader,
  Radio
}
const myComponents = {
  ActionButtons,
  DictSelect,
  StandardTable,
  StandardDrawer,
  StandardDialog
}
const LoadAntd = Vue => {
  Object.keys(Antd).forEach(key => {
    Vue.use(Antd[key])
  })
  // 注册全局message
  Vue.prototype.$message = message
  // 注册全局组件
  Object.values(myComponents).forEach(component => {
    let isFunction = component instanceof Function
    isFunction ? Vue.use(component) : Vue.component(component.name, component)
  })
}

export default LoadAntd
